parameters:
  condition: false
  extraBuildArgs: ''
  isExtraPlatformsBuild: false
  nameSuffix: ''
  platforms: []
  publishArtifactsForWorkload: false
  publishWBT: false

jobs:

#
# Build for Browser/wasm
#
- template: /eng/pipelines/common/platform-matrix.yml
  parameters:
    jobTemplate: /eng/pipelines/common/global-build-job.yml
    buildConfig: Release
    runtimeFlavor: mono
    platforms: ${{ parameters.platforms }}
    variables:
      # map dependencies variables to local variables
      - name: workloadSubsetArg
        ${{ if eq(parameters.publishArtifactsForWorkload, true) }}:
          value: '+mono.wasmworkload'
        ${{ else }}:
          value: ''
      - name: extraBuildArgs
        ${{ if eq(parameters.publishWBT, true) }}:
          value: /p:TestWasmBuildTests=true /p:ArchiveTests=true /p:InstallWorkloadForTesting=false
        ${{ else }}:
          value: ''

    jobParameters:
      isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
      testGroup: innerloop
      nameSuffix: ${{ parameters.nameSuffix }}_BuildOnly
      buildArgs: -s mono+libs+packs+libs.tests$(workloadSubsetArg) -c $(_BuildConfig) /p:BrowserHost=$(_hostedOs) ${{ parameters.extraBuildArgs }} /p:TestAssemblies=false $(extraBuildArgs)
      timeoutInMinutes: 120
      condition: ${{ parameters.condition }}
      postBuildSteps:
        - template: /eng/pipelines/common/wasm-post-build-steps.yml
          parameters:
            publishArtifactsForWorkload: ${{ parameters.publishArtifactsForWorkload }}
            publishWBT: ${{ parameters.publishWBT }}
